/* $Id: AppMetaDataDomainObjectManager.java 
 * Copyright (C) 2011, TRAKHEES
 *  
 * Revision History
 *
 * Date  			Author 		    	Remarks
 * ---------------------------------------------------------------------------------
 *
 */
package ae.pcfc.etks.online.common.domain.manager;

import java.util.List;

import ae.pcfc.etks.online.common.ConstantsCommon.WFProcessType;
import ae.pcfc.etks.online.common.domain.AppMetaData;
import ae.pcfc.etks.online.common.exception.LookupException;
import ae.pcfc.etks.online.common.exception.PersistenceException;
import ae.pcfc.etks.online.common.vo.AppMetaDataDetailVO;
import ae.pcfc.etks.online.common.vo.LabelVO;
import ae.pcfc.etks.online.common.vo.WorkflowRequestSearchCriteriaVO;
import ae.pcfc.etks.online.common.vo.WorkflowRequestVO;


public interface AppMetaDataDomainObjectManager extends BaseDomainObjectManager{
	
	/**
	 * findByPrimaryKeyProcessAndStepCode
	 * Method to find the application request by primary key, process code and process step code
	 * @param id
	 * @param proccesCode
	 * @param processStepCode
	 * @return
	 * @throws LookupException
	 * AppMetaData
	 */
	public AppMetaData findByPrimaryKeyProcessAndStepCode(String id, String proccesCode, String processStepCode) throws LookupException;
	
	/**
	 * getNextApplicationId
	 * Method to find the next application id in the sequence
	 * @return
	 * @throws LookupException
	 * String
	 */
	public String getNextApplicationId() throws LookupException;
	
	/**
	 * findByPrimaryKey
	 * Method to find an entity by primary key
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#findByPrimaryKey(java.lang.String)
	 * 
	 */
	public <T> T findByPrimaryKey(String id) throws LookupException;
	
	/**
	 * findAppMetaDataByUserId
	 * Method to find the application requests of a user (user id)
	 * @param id
	 * @return
	 * @throws LookupException
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findAppMetaDataByUserId(Long id) throws LookupException;
	
	/**
	 * findByClientRefNo
	 * Method to find the application request by client reference number
	 * @param refNo
	 * @return
	 * @throws LookupException
	 * AppMetaData
	 */
	public AppMetaData findByClientRefNo(String refNo) throws LookupException;
	
	/**
	 * findCompletedAppMetaDataByUserId
	 * Method to find the list of completed application requests of an user (user id)
	 * @param id
	 * @return
	 * @throws LookupException
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findCompletedAppMetaDataByUserId(Long id) throws LookupException;

	/**
	 * isValidClient
	 * Method to find whether the application request is valid
	 * @param applicationId
	 * @return
	 * boolean
	 * 	returns	 true if the application requests is rejected
	 * 				else false
	 */
	public boolean isValidClient(Long applicationId);

	/**
	 * findAppMetaDataByExample
	 * Method to find the application requests by a sample application request object which is used for filtering
	 * @param appMetaDataDetailVO
	 * @return
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findAppMetaDataByExample(AppMetaDataDetailVO appMetaDataDetailVO);
	
	/**
	 * add
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#add(java.lang.Object)
	 * 
	 */
	public <T> void add(T obj) throws PersistenceException;

	/**
	 * update
	 * 
	 * @see ae.pcfc.etks.online.common.domain.manager.BaseDomainObjectManager#update(java.lang.Object)
	 * 
	 */
	public <T> void update(T obj) throws PersistenceException;

	/**
	 * updateStatus
	 * Method to update the status of an application request
	 * @param applicationId
	 * @param statusEn
	 * @param statusAr
	 * void
	 */
	public void updateStatus(String applicationId, String statusEn,String statusAr);

	/**
	 * findApplicationRequestsByProcessCode
	 * Method to find the application requests by process code
	 * @param processType
	 * @return
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findApplicationRequestsByProcessCode(WFProcessType processType);

	/**
	 * findApplicationRequestsByInitiator
	 * Method to find the application requests by initiator
	 * @param username
	 * @return
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findApplicationRequestsByInitiator(String username);

	/**
	 * findApplicationRequestsByApplicationDate
	 * Method to find the application requests by application date
	 * @param date
	 * @return
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findApplicationRequestsByApplicationDate(String date);

	/**
	 * findAppMetaDataByUserName
	 * Method to find the application requests by username
	 * @param strUserName
	 * @return
	 * List<AppMetaData>
	 */
	public List<AppMetaData> findAppMetaDataByUserName(String strUserName);

	public List<WorkflowRequestVO> findWorkflowRequests(WorkflowRequestSearchCriteriaVO searchCriteria);


//	public List<AppMetaData> findCompletedAppMetaDataByUserId(AppMetaDataDetailVO appMetaDataDetailVO);
	
	/**
	 * updateAppMetaDataWithActionTaken
	 * To update the appmetadata domain object with the action taken information 
	 * @param appMetaData 
	 * 
	 * @param strStepName
	 * void
	 */
	public void updateAppMetaDataWithActionTaken(AppMetaData appMetaData, String strStepName);

	/**
	 * updateAppMetaDataWithActionTaken
	 * To undo the update the appmetadata domain object with the action taken information 
	 * @param appMetaData 
	 * 
	 * @param strStepName
	 * void
	 */
	public void undoUpdateAppMetaDataWithActionTaken(AppMetaData appMetaData, String strStepName);

	/**
	 * validateAppMetaDataWithStep
	 * 
	 * @param appMetaData
	 * @param strStepName
	 * void
	 */
	public boolean validateAppMetaDataWithStep(AppMetaData appMetaData, String strStepName);
	
	public List<LabelVO> searchRequestStatus(String searchString);
}
